package com.prism.e4.rcp.ui.handlers;

import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EModelService;

import com.prism.e4.rcp.ui.parts.E4PrismEditor;

public class CopyHandler {

	@Execute
	public void execute(MApplication application, EModelService modelService) {

		// NOTE: works only if there is one part with given id
		MPart existedPart = (MPart) modelService.find(
				"com.prism.e4.rcp.inputpart", application);
		if (!existedPart.isVisible())
			existedPart.setVisible(true);
		E4PrismEditor editor = (E4PrismEditor) existedPart.getObject();

		editor.editorService.copy();
	}
}
